public class HomeWork06_03{
    public static void main(String[] args){
        ItegerFilter itgerFilter = new ItegerFilter();
        int count = 0;
        for(int i = 1; i <= 1000; i++){
            if(itgerFilter.filter(i)){
                System.out.print(i + " ");
                ++count;
            }
            if(count == 6){
                System.out.println();
                count = 0;
            }
        }
    }
}